package com.mall.user.services;
/*
 * @ClassName : ILoginServiceImpl
 * @Description :
 * @Author : Jason
 * @Date : 2021/7/21 21:48:03
 * @Version : V1.0
 */

import com.mall.user.ILoginService;
import com.mall.user.constants.SysRetCodeConstants;
import com.mall.user.dto.CheckAuthRequest;
import com.mall.user.dto.CheckAuthResponse;
import com.mall.user.utils.JwtTokenUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.Service;

@Service
@Slf4j
public class ILoginServiceImpl implements ILoginService {
    @Override
    public CheckAuthResponse validToken(CheckAuthRequest checkAuthRequest) {
        CheckAuthResponse checkAuthResponse = new CheckAuthResponse();
        checkAuthRequest.requestCheck();

        String token = checkAuthRequest.getToken();
        String s = JwtTokenUtils.builder().token(token).build().freeJwt();
        checkAuthResponse.setUserinfo(s);
        checkAuthResponse.setCode(SysRetCodeConstants.SUCCESS.getCode());
        checkAuthResponse.setMsg(SysRetCodeConstants.SUCCESS.getMessage());
        return checkAuthResponse;
    }
}
